{% extends 'airshow/base.html' %}

{% block title %}活动详情列表 - 珠海航展数据管理系统{% endblock %}

{% block content %}
<div class="d-flex justify-content-between align-items-center mb-4">
    <h2>活动详情列表</h2>
</div>

<div class="card mb-4">
    <div class="card-header">
        <h5>筛选条件</h5>
    </div>
    <div class="card-body">
        <form method="get" class="row g-3">
            <div class="col-md-4">
                <label for="area_id" class="form-label">展区</label>
                <select class="form-select" id="area_id" name="area_id">
                    <option value="">所有展区</option>
                    {% for area in areas %}
                        <option value="{{ area.area_id }}" {% if request.GET.area_id == area.area_id|stringformat:"i" %}selected{% endif %}>{{ area.name }}</option>
                    {% endfor %}
                </select>
            </div>
            <div class="col-md-4 d-flex align-items-end">
                <button type="submit" class="btn btn-primary">筛选</button>
                {% if request.GET.area_id %}
                    <a href="{% url 'airshow:event_details_list' %}" class="btn btn-secondary ms-2">清除筛选</a>
                {% endif %}
            </div>
        </form>
    </div>
</div>

<div class="card">
    <div class="card-header">
        <h5>活动详情列表</h5>
    </div>
    <div class="card-body">
        {% if events %}
            <div class="table-responsive">
                <table class="table table-striped">
                    <thead>
                        <tr>
                            <th>活动名称</th>
                            <th>时间</th>
                            <th>展区</th>
                            <th>参展商</th>
                            <th>展品</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        {% for event in events %}
                            <tr>
                                <td>{{ event.title }}</td>
                                <td>{{ event.event_time|date:"Y-m-d H:i" }}</td>
                                <td>{{ event.area.name }}</td>
                                <td>{% if event.exhibitor %}{{ event.exhibitor.name }}{% else %}无{% endif %}</td>
                                <td>{% if event.exhibit %}{{ event.exhibit.name }}{% else %}无{% endif %}</td>
                                <td>
                                    <a href="{% url 'airshow:schedule_detail' event.event_id %}" class="btn btn-sm btn-info">查看详情</a>
                                </td>
                            </tr>
                        {% endfor %}
                    </tbody>
                </table>
            </div>
        {% else %}
            <p class="text-center">暂无活动详情数据</p>
        {% endif %}
    </div>
</div>
{% endblock %} 